package com.agent.vpsserver.common.exception;

import com.agent.vpsserver.common.enmus.ResponseCode;

/**
 * @author ludezh
 * @company Information Technology
 * @description 业务异常类, 主要用于将错误信息返回给前端
 * @since 2017/11/24
 */
public class HintException extends BaseException {

    private static final long serialVersionUID = 1735388308027428062L;
    /**
     * 是否回滚事务
     */
    private final boolean isRollback;

    public HintException(String code, String description, boolean isRollback) {
        super(code, description, false, null);
        this.isRollback = isRollback;
    }

    public HintException(String description) {
        this(null, description, false);
    }

    public HintException(String description, boolean isRollback) {
        this(null, description, isRollback);
    }

    public HintException(ResponseCode resp) {
        this(resp.getCode(), resp.getDescribe(), false);
    }

    public HintException(ResponseCode resp, boolean isRollback) {
        this(resp.getCode(), resp.getDescribe(), isRollback);
    }

    @Override
    public synchronized Throwable fillInStackTrace() {
        return null;
    }

    public boolean isRollback() {
        return isRollback;
    }
}
